#ifndef __MYTASK_H__
#define __MYTASK_H__
#include <iostream>
#include "TcpConnection.h"
#include "LRUCache.h"
#include "KeyRecommander.h"
#include "WebPageSearcher.h"

using std::cout;
using std::endl;

class MyTask
{
    using TcpConnectionPtr = shared_ptr<TcpConnection>;
public:
    /* MyTask(const string &msg,TcpConnectionPtr con); */
    MyTask(const train_t &train,TcpConnectionPtr con,
                   KeyRecommander* pKeyRecommander,
                   WebPageSearcher* pWebPageSearcher,
                   LRUCache* pLRUCache);
    ~MyTask();

    void process();

private:
    //把文章中的双引号自动加上转义字符
    std::string addEscapeToQuotes(const std::string& input);
    std::string delEscapeToQuotes(const std::string& input);
private:
    train_t _train;
    /* string _msg; */
    TcpConnectionPtr _conn;
    KeyRecommander* _pKeyRecommander;   //用于关键字推荐
    WebPageSearcher* _pWebPageSearcher; //用于网页搜索
    LRUCache* _pLRUCache; //用于缓存的实现
};

#endif
